import React from 'react';
import {Text, StyleSheet} from 'react-native';
import {List} from '@ant-design/react-native';
import {Container} from '@/rcomponents';
import colors from '@/Themes/Colors';
import LoginStore from '@/stores/loginStore';
import AboutScreen from './about';

const styles = StyleSheet.create({
  marginVert10: {marginVertical: 10},
  logoutTxt: {
    textAlign: 'center',
    fontWeight: 'bold',
    fontSize: 16,
    color: colors.red500,
  },
});
const SettingScreen = ({navigation}) => {
  const loginStore = LoginStore.useStore();
  return (
    <Container>
      <List>
        <List.Item
          arrow="horizontal"
          onPress={() => {
            navigation.navigate(AboutScreen.routeName);
          }}>
          关于
        </List.Item>
      </List>
      <List style={styles.marginVert10}>
        <List.Item
          disabled={loginStore.logoutUser.loading}
          onPress={async () => {
            await loginStore.logoutUser();
          }}>
          <Text style={styles.logoutTxt}>退出</Text>
        </List.Item>
      </List>
    </Container>
  );
};

SettingScreen.routeName = 'SettingScreen';
export default SettingScreen;
